﻿@{
    ViewBag.Title = "ChangePassWord";
    Layout = "~/Views/Shared/_LoginLayout.cshtml";
}
<div class="row">
    <div class="col-md-12">
        <form class="form-horizontal">

            <div class="form-group">
                <label for="exampleInputPassword1">密码</label>
                <input type="password" name="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
            </div>
            <div class="form-group">
                <label for="exampleInputPassword1">确认密码</label>
                <input type="password" name="confirmpassword" class="form-control" id="exampleInputPassword2" placeholder="Password">
            </div>
            <div class="form-group">
                <div class="col-md-10">
                    <button type="button" id="btnChange" class="btn btn-default">修改密码</button>
                </div>
            </div>
        </form>
    </div>
    <input type="hidden" id="hidEmail" value="@ViewBag.Email" />
</div>
@section scripts{
   <script>
       $(function () {
           $("#btnChange").click(function () {
               $.ajax({
                   url: '/Admin/Account/change-pwd',
                   type: 'post',
                   data: { 'password': $("#exampleInputPassword1").val(), 'email': $("#hidEmail").val() },
                   async: false, //默认为true 异步   
                   error: function () {
                       alert('密码修改失败!');
                   },
                   success: function (data) {
                       alert('密码修改成功!');
                   }
               });
           });
       });
   </script>
    }